package com.shiro.sdk.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties
@ConfigurationProperties(prefix = "shiro")
public class ShiroProperties {

    /**
     * 登录路径
     */
    private String loginUrl;

    /**
     * 登出路径
     */
    private String logoutUrl;

    /**
     * 首页路径
     */
    private String indexUrl;

    /**
     * 未授权跳转路径
     */
    private String unauthorizedUrl;

    /**
     * 要忽略的url
     */
    private String ignoresUrlList;

    /**
     * 是否启用ShiroJwt true 启用  false 禁用 ,  默认启用
     */
    private boolean enable = true;

    /**
     * 是否支持跨域访问 默认为 true
     */
    private boolean corsEnable = true;

    /**
     * 是否启用 token 自动刷新
     */
    private boolean tokenRefreshEnable = true;

    /**
     * token放在 http HEADER 里面的 key名称，默认为 Authorization
     */
    private String tokenHeaderKey = "Authorization";



    /**
     * 是否开启缓存 默认缓存组件MemoryConstrainedCacheManager,  默认不开启
     */
    private boolean enableCacheMemory = false;


    public String getLoginUrl() {
        return loginUrl;
    }

    public void setLoginUrl(String loginUrl) {
        this.loginUrl = loginUrl;
    }

    public String getLogoutUrl() {
        return logoutUrl;
    }

    public void setLogoutUrl(String logoutUrl) {
        this.logoutUrl = logoutUrl;
    }

    public String getIgnoresUrlList() {
        return ignoresUrlList;
    }

    public void setIgnoresUrlList(String ignoresUrlList) {
        this.ignoresUrlList = ignoresUrlList;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public boolean isCorsEnable() {
        return corsEnable;
    }

    public void setCorsEnable(boolean corsEnable) {
        this.corsEnable = corsEnable;
    }

    public boolean isTokenRefreshEnable() {
        return tokenRefreshEnable;
    }

    public void setTokenRefreshEnable(boolean tokenRefreshEnable) {
        this.tokenRefreshEnable = tokenRefreshEnable;
    }

    public String getTokenHeaderKey() {
        return tokenHeaderKey;
    }

    public void setTokenHeaderKey(String tokenHeaderKey) {
        this.tokenHeaderKey = tokenHeaderKey;
    }

    public boolean isEnableCacheMemory() {
        return enableCacheMemory;
    }

    public void setEnableCacheMemory(boolean enableCacheMemory) {
        this.enableCacheMemory = enableCacheMemory;
    }

    public String getIndexUrl() {
        return indexUrl;
    }

    public void setIndexUrl(String indexUrl) {
        this.indexUrl = indexUrl;
    }

    public String getUnauthorizedUrl() {
        return unauthorizedUrl;
    }

    public void setUnauthorizedUrl(String unauthorizedUrl) {
        this.unauthorizedUrl = unauthorizedUrl;
    }
}
